import { RESPONSIVE_STYLES } from '../../../types/constants'

export function styles(className: string, columnLimit: number = 6): string {
  return `
    /* 主容器 */
    .${className} {
      border-radius: 8px;
      padding: 0 10px;
    }

    /* 空状态 */
    .no-favorites {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 0;
      color: #6a737d;

      .icon {
        font-size: 28px;
        margin-bottom: 12px;
        color: #d1d5da;
      }
        
      .text {
        font-size: 14px;
        font-weight: 500;
      }
    }
      
    /* 网格布局 */
    .favorites-list {
      display: grid;
      grid-template-columns: repeat(${columnLimit}, 1fr);
      gap: 12px;
      padding-top: 12px;
      margin-top: 8px;
      
      ${RESPONSIVE_STYLES.BASE}
    }

    /* 收藏项 */
    .favorite-item {
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      text-align: center;
      padding: 12px;
      margin-bottom: 8px;
      background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
      border-radius: 8px;
      border: 1px solid #e1e4e8;
      cursor: pointer;
      min-height: 20px;
      overflow: hidden;
      box-shadow: 0 2px 4px rgba(0,0,0,0.03);
      z-index: 1;
      transition: all 0.3s ease;

      &:hover {
        transform: scale(1.05);
        box-shadow: 
          0 6px 16px rgba(0,0,0,0.12),
          0 3px 6px rgba(0,0,0,0.08);
        border-color: #c9cfd6;
        z-index: 2;

        .remove {
          opacity: 1;
          transform: scale(1);
        }
      }
        
      .name {
        font-size: 13px;
        font-weight: 500;
        color: #24292e;
        line-height: 1.4;
        word-break: break-word;
        flex-wrap: wrap;
        width: 100%;
        padding: 0 8px; /* 添加内边距防止文字贴边 */
        flex-grow: 1; /* 占据剩余空间 */
      }
        
      .remove {
        position: absolute;
        top: 6px;
        right: 6px;
        width: 15px;
        height: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #f6f8fa;
        border-radius: 50%;
        opacity: 0;
        transform: scale(0.8);
        transition: all 0.2s ease;
        color: #d73a49;
        font-size: 14px;
        border: 1px solid #e1e4e8;
        z-index: 2; /* 确保在文字上方 */

        &:hover {
          background-color: #d73a49;
          color: white;
          border-color: transparent;
          transform: scale(1.1);
        }
      }
    }

    .favorite-item:hover::after {
      opacity: 1;
    }
  `
}
